<template>
  <q-dialog v-model="visible">
    <q-card style="width: 370px;">
      <q-card-section>
        <div class="text-h6" style="font-size: 17px;">
          <el-icon
            :style="[colorStyle]"
            class="titleIcon"
            >
            <WarningFilled />
          </el-icon>
          <span class="titleText">{{title}}</span>
        </div>
      </q-card-section>
      <q-card-section class="q-pt-none">
        <div>{{content}}</div>
      </q-card-section>
      <q-card-actions align="right" class="text-primary" style="margin-right: 10px;margin-top: 10px">
        <el-button @click="closeDialog" style="background-color: #fff!important;">取消</el-button>
        <el-button type="primary" @click="submit">确认</el-button>
      </q-card-actions>
    </q-card>
  </q-dialog>
</template>
<script lang='ts' setup>
import { ref,defineExpose  } from 'vue';

const emit = defineEmits({
  submit: () => {
    return { e: 'submit' };
  }
});

let visible = ref(false)

const props = defineProps({
  colorStyle: {
    type: Object,
    default: () => {
      return {}
    }
  },
  title:{
    type: String,
    default: ''
  },
  content: {
    type: String,
    default: ''
  }
})
// 打开
const show = (data?: any) => {
  visible.value = true;
}
// 提交
const submit = () => {
  emit('submit')
  visible.value = false;
}
// 关闭
const closeDialog = () => {
  visible.value = false;
};

defineExpose({
  show
})

</script>

<style lang='scss' scoped>
.titleIcon {
  display: inline-block;
  vertical-align: middle;
  margin-top: -3px;
  font-size: 20px;
}
.titleText {
  font-size: 16px;
  margin-left: 5px;
  color: #FFA940;
}
.dialog-content {
  height: 400px;
  overflow-y: scroll;
}
.dialog-footer{
  text-align: center;
}
</style>
